@extends('admin/layouts.default')

{{-- Web site Title --}}
@section('title')
Edit Bank ::
@parent
@stop

{{-- Content --}}
@section('content')
<div class="page-header">
    <h3>
       Edit Bank
        <div class="pull-right">
            <a href="{{{ URL::to('admin/places') }}}" class="btn btn-small btn-inverse"><i class="icon-circle-arrow-left icon-white"></i> Back</a>
        </div>
    </h3>
</div>

<!-- Tabs -->
<ul class="nav nav-tabs">
    <li class="active"><a href="#tab-general" data-toggle="tab">General</a></li>
    <li><a href="#tab-media" data-toggle="tab">Media</a></li>
</ul>
<!-- ./ tabs -->

<form class="form-horizontal" method="post" action="" autocomplete="off" enctype="multipart/form-data">
    <!-- CSRF Token -->
    <input type="hidden" name="_token" value="{{{ csrf_token() }}}" />
    <!-- ./ csrf token -->
    <input type="hidden" name="oldprovince" value='{{ json_encode($oldProvinces) }}'>
    <!-- Tabs Content -->
    <div class="tab-content">
        <!-- General tab -->
        <div class="tab-pane active" id="tab-general">

            <!-- Post Title -->
            <div class="control-group {{{ $errors->has('name') ? 'error' : '' }}}">
                <label class="control-label" for="title">Name</label>
                <div class="controls">
                    <input type="text" name="name" id="title" class="span10" value="{{{ Input::old('name', $place->name) }}}" />
                    {{ $errors->first('name', '<span class="help-inline">:message</span>') }}
                </div>
            </div>
            <!-- ./ post title -->

            <!-- Post province -->
            <div class="control-group {{{ $errors->has('category') ? 'error' : '' }}}">
                <label class="control-label" for="title">Category</label>
                <div class="controls">
                    <select name="category" id="category">
                       @foreach ($categories as $cat)
                            @if ($cat->id == $place->category_id)
                                <option value="{{ $cat->id }}" selected>{{ $cat->title }}</option>
                            @else
                                <option value="{{ $cat->id }}">{{ $cat->title }}</option>
                            @endif

                      @endforeach
                    </select>
                    {{ $errors->first('category', '<span class="help-inline">:message</span>') }}
                </div>
            </div>
            <!-- ./ post provinces -->
            <div class="control-group {{{ $errors->has('province') ? 'error' : '' }}}">
                <label class="control-label" for="title">Province</label>
                <div class="controls">
                    <select name="provinces[]" id="category" multiple>
                       @foreach ($provinces as $province)
                           @if ( in_array($province->id, $oldProvinces))
                        <option value="{{ $province->id }}" selected="selected">{{ $province->name }}</option>
                            @else
                                <option value="{{ $province->id }}">{{ $province->name }}</option>
                            @endif
                      @endforeach
                    </select>
                    {{ $errors->first('province', '<span class="help-inline">:message</span>') }}
                </div>
            </div>
            <!-- Content -->
            <div class="control-group {{{ $errors->has('description') ? 'error' : '' }}}">

                <label class="control-label" for="content">Description</label>
                <div class="controls">
                    <textarea class="full-width span10 wysihtml5" name="description" value="description" rows="10">{{{ Input::old('description', $place->description)}}}</textarea>
                    {{ $errors->first('description', '<span class="help-inline">:message</span>') }}
                </div>
            </div>
            <!-- ./ content -->
        </div>
        <!-- ./ general tab -->
        <!-- Media Tap -->
        <div class="tab-pane" id="tab-media">
            <div class="control-group {{{ $errors->has('logo') ? 'error' : '' }}}">
                <label class="control-label" for="logo">Logo</label>
                <div class="controls">
                    <input type="text" name="logo" id="logo" class="input-xlarge" value="{{{ $place->logo }}}" />
                    {{ $errors->first('logo', '<span class="help-inline">:message</span>') }}
                </div>
            </div>

            <div class="thumbnail">
                    <img src="/uploads/images/thumb/{{ $place->logo }}" />
            </div>
            <div class="control-group {{{ $errors->has('logo') ? 'error' : '' }}}">
                <label class="control-label" for="content">Logo</label>
                <div class="controls">
                     <input type="file" name="logo"/>
                      {{ $errors->first('logo', '<span class="help-inline">:message</span>') }}
                </div>
            </div>
        </div>
    </div>
    <!-- ./ tabs content -->

    <!-- Form Actions -->
    <div class="control-group">
        <div class="controls">
            <a class="btn btn-link" href="{{{ URL::to('admin/places') }}}">Cancel</a>
            <button type="submit" class="btn btn-success">Update</button>
        </div>
    </div>
    <!-- ./ form actions -->
</form>

@stop
